package com.pkx.guide.info.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pkx.guide.common.annotation.Log;
import com.pkx.guide.common.annotation.ORpose;
import com.pkx.guide.common.enums.BusinessType;
import com.pkx.guide.info.entity.TInfoGuideStatusHistory;
import com.pkx.guide.info.service.TInfoGuideStatusHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 诱导屏状态表历史记录
 *
 * @Author : YangLe
 * @create 2025/10/29 10:58
 */
@RestController
@RequestMapping("/info/guideStatusHistory")
@Tag(name = "诱导屏状态历史记录表")
@Slf4j
@ORpose
public class TInfoGuideStatusHistoryController {
    @Autowired
    private TInfoGuideStatusHistoryService tInfoGuideStatusHistoryService;

    @Operation(summary = "诱导屏状态历史记录表分页列表")
    @GetMapping("/page")
    public IPage<TInfoGuideStatusHistory> page(Page page, TInfoGuideStatusHistory tInfoGuideStatusHistory) {
        return tInfoGuideStatusHistoryService.pageList(page,tInfoGuideStatusHistory);
    }

    @Operation(summary = "诱导屏状态历史记录表列表")
    @GetMapping("/list")
    public List<TInfoGuideStatusHistory> list( TInfoGuideStatusHistory tInfoGuideStatusHistory) {
        return tInfoGuideStatusHistoryService.listByEntity(tInfoGuideStatusHistory);
    }

    @Operation(summary = "诱导屏状态历史记录表详情")
    @GetMapping(value = "/{id}")
    public TInfoGuideStatusHistory selectById(@PathVariable("id") Integer id) {
        return tInfoGuideStatusHistoryService.selectById(id);
    }

    @Operation(summary = "诱导屏状态历史记录表新增")
    @PostMapping("/")
    @Log(title = "诱导屏状态历史记录表表", businessType = BusinessType.INSERT)
    public Boolean add(@RequestBody TInfoGuideStatusHistory tInfoGuideStatusHistory) {
        return tInfoGuideStatusHistoryService.saveTInfoGuideStatus(tInfoGuideStatusHistory);
    }

    @Operation(summary = "诱导屏状态历史记录表修改")
    @PutMapping("/")
    @Log(title = "诱导屏状态历史记录表", businessType = BusinessType.UPDATE)
    public Boolean modify(@RequestBody TInfoGuideStatusHistory tInfoGuideStatusHistory) {
        return tInfoGuideStatusHistoryService.modify(tInfoGuideStatusHistory);
    }

    @Operation(summary = "诱导屏状态历史记录表删除(单个条目)")
    @DeleteMapping(value = "/{id}")
    @Log(title = "诱导屏状态历史记录表", businessType = BusinessType.DELETE)
    public Boolean deleteById(@PathVariable("id") Integer id) {
        return tInfoGuideStatusHistoryService.deleteById(id);
    }

}
